package com.lcf.system.vo.permission;

import com.lcf.framework.enums.PermissionEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author lcf
 */
@Data
@NoArgsConstructor
public class PermissionVO {
    /**
     * 分类
     */
    @Schema(description = "分类")
    private String type;

    /**
     * 权限列表
     */
    @Schema(description = "权限列表")
    private List<PermissionChildrenVO> list;

    public PermissionVO(PermissionEnum.PermissionTypeEnum type, List<PermissionEnum> list) {
        this.type = type.getName();
        this.list = list.stream().map(PermissionChildrenVO::new).toList();
    }
}
